import http from "@/api/http";

const BASE_URL_PATH = "/kbDocument";

export default {
  getDirTree(params) {
    return http.get(`${BASE_URL_PATH}/dir/tree`, params);
  },
  createDir(data) {
    return http.post(`${BASE_URL_PATH}/dir`, { data: JSON.stringify(data) });
  },
  updateDir(data) {
    return http.put(`${BASE_URL_PATH}/dir`, { data: JSON.stringify(data) });
  },
  deleteDir(id) {
    return http.delete(`${BASE_URL_PATH}/dir/${id}`);
  },
  dragMoveDir({ id, refId, dropType }) {
    return http.post(`${BASE_URL_PATH}/dir/dragMove`, {
      data: JSON.stringify({
        id,
        refId,
        dropType,
      }),
    });
  },
  docUploadUrl: `${BASE_URL_PATH}/doc/upload`,

  getDocList(dirId) {
    return http.get(`${BASE_URL_PATH}/doc/list`, { params: { dirId } });
  },
  deleteDocs(idList) {
    return http.post(`${BASE_URL_PATH}/doc/multiDelete`, {
      data: JSON.stringify(idList),
    });
  },
};
